package com.wowangz.cms.common.pojo;

import java.util.ArrayList;
import java.util.HashMap;

import com.wowangz.cms.common.easyui.tree.TreeInfo;
import com.wowangz.cms.syscore.api.UserContext.MessageType;
import com.wowangz.cms.syscore.pojo.AbstractEntity;


public class AjaxDataEntity {
	
	protected long messagetype = MessageType.NONE;
	protected String message = "";
	protected AbstractEntity entity = null;
	protected HashMap<String, Object> map = new HashMap<String, Object>();
	protected ArrayList<TreeInfo> tree = new ArrayList<TreeInfo>();
	//add by yoyo 很多时候需要用ajax取下拉框信息，可以将下拉框的json放入此属性
	protected String selectInfo = "";
	
	public void addData(String key, Object value) {
		map.put(key, value);
		
	}
	public void putAll(HashMap<String, Object> map) {
		this.map.putAll(map);
	}
	public void clear() {
		map.clear();
	}
	public void remove(String key) {
		map.remove(key);
	}
	public long getMessagetype() {
		return messagetype;
	}
	public void setMessagetype(long messagetype) {
		this.messagetype = messagetype;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

	public AbstractEntity getEntity() {
		return entity;
	}

	public void setEntity(AbstractEntity entity) {
		this.entity = entity;
	}

	public HashMap<String, Object> getMap() {
		return map;
	}
	
	public void addTreeInfo(TreeInfo treeInfo) {
		tree.add(treeInfo);
	}
	
	public void addTreeInfo(TreeInfo[] treeInfo) {
		for(int i=0; i<treeInfo.length; i++){
			tree.add(treeInfo[i]);
		}
	}
	
	public ArrayList<TreeInfo> getTree() {
		return tree;
	}
	public String getSelectInfo() {
		return selectInfo;
	}
	public void setSelectInfo(String selectInfo) {
		this.selectInfo = selectInfo;
	}
	
}
